package com.example.blog.enums;

import org.springframework.util.StringUtils;

/**
 *  * 操作状态
 * @ClassName BusinessStatus
 * @Description TODO
 * @Date 2021-02-03 15:02
 * @Version 1.0
 **/
public enum RedisStatus
{
    CREATOR(1, "creator"),
    ADMIN(2, "admin");
    private Integer code;

    private String description;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    private RedisStatus(Integer common, String description) {
        this.code = common;
        this.description = description;
    }

    public static RedisStatus get(Integer common) {
        if (StringUtils.hasLength(String.valueOf(common))) {
            for (RedisStatus element : RedisStatus.values()) {
                if (element.getCode().equals(common)) {
                    return element;
                }
            }
        }
        return null;
    }
}
